package com.apes.fico.engine.timerTask;

import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class DateUtil {
    /*
   * 转换成字符串
   * */
    public static String format(LocalDate localDate, String pattern) {
        return localDate.format(DateTimeFormatter.ofPattern(pattern));
    }

    /*
    * 转换成字符串
    * */
    public static String format(Date date, String pattern) {
        return format(Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDate(),pattern);
    }


    public static LocalDate parse(String dateStr, String pattern) {
        return  LocalDate.parse(dateStr, DateTimeFormatter.ofPattern(pattern));
    }

}
